#ifndef STYLESETWIDGET_H
#define STYLESETWIDGET_H

#include <QTreeWidget>
#include <QMap>
#include "common.h"
#include "viewobject.h"

class QComboBox;
class QLineEdit;
class StyleSetWidget : public QTreeWidget
{
    Q_OBJECT
public:
    explicit StyleSetWidget(QWidget *parent = 0);
    ~StyleSetWidget();
    void StationViewStyleSet();
    void CommonViewStyleSet();

    void GetStyleData(QString style);

    void StyleWidgetSetData(ViewObjectInfo *info);

    void SetMapData(QMap<QString, QString> &map, QSettings &settings);

    void SetAnimationComboBoxData(QMap<QString, QString> map, QComboBox *box);

    void ShowDataAndRecord(QMap<QString, QString> &map);

    void DeleteStyleGroup();
signals:

public slots:
    void CommonAnimationChanged(QString text);
    void CommonPlaceWayEditFinished();
    void CommonQss1EditFinished();
    void CommonQss2EditFinished();
    void CommonFormatEditFinished();

    void CurrAnimationChanged(QString text);
    void CurrPlaceWayEditFinished();
    void CurrQss1EditFinished();
    void CurrQss2EditFinished();
    void CurrFormatEditFinished();

    void PassAnimationChanged(QString text);
    void PassPlaceWayEditFinished();
    void PassQss1EditFinished();
    void PassQss2EditFinished();
    void PassFormatEditFinished();

    void FutureAnimationChanged(QString text);
    void FuturePlaceWayEditFinished();
    void FutureQss1EditFinished();
    void FutureQss2EditFinished();
    void FutureFormatEditFinished();

private:

    //控件指针
    ViewObjectInfo *m_info;
    //样式名 ## 资源(文本内容或者图片名)
    QString m_url;
    //资源样式名称
    QString m_style;
    //资源路径
    QString m_prefix;
    //控件显示资源格式后缀png hqt hqv gif
    QString m_suffix;
    //控件所在界面类型all interval arrive
    QString m_filename;
    //控件实例唯一标志
    QString m_name;
    //控件类型
    QString m_object_name;

    QMap<QString, QString> m_common_style_data;
    QMap<QString, QString> m_curr_style_data;
    QMap<QString, QString> m_pass_style_data;
    QMap<QString, QString> m_future_style_data;

    QComboBox *m_com_animation;
    QLineEdit *m_edit_place_way;
    QLineEdit *m_edit_qss1;
    QLineEdit *m_edit_qss2;
    QLineEdit *m_edit_format;

    QComboBox *m_curr_com_animation;
    QLineEdit *m_curr_edit_place_way;
    QLineEdit *m_curr_edit_qss1;
    QLineEdit *m_curr_edit_qss2;
    QLineEdit *m_curr_edit_format;

    QComboBox *m_pass_com_animation;
    QLineEdit *m_pass_edit_place_way;
    QLineEdit *m_pass_edit_qss1;
    QLineEdit *m_pass_edit_qss2;
    QLineEdit *m_pass_edit_format;

    QComboBox *m_future_com_animation;
    QLineEdit *m_future_edit_place_way;
    QLineEdit *m_future_edit_qss1;
    QLineEdit *m_future_edit_qss2;
    QLineEdit *m_future_edit_format;

    //动画类型
    const QStringList m_animation_text = {tr("None"), tr("LeftRight"), tr("OpacityEffect"), tr("Scale"), tr("TwoFrameScale")};
    //排列方式类型
    const QStringList m_place_way_text = {tr("PH"), tr("PV"), tr("P45")};
    //edit样式
    const QString m_edit_qss = "border : none;"
                             "border-left : 1px solid lightgray;"
                             "background-color : transparent;"
                             "qproperty-cursorPosition: 0";
};

#endif // STYLESETWIDGET_H
